<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>v-model 结合单选按钮的使用</title>
</head>
<body>
<div id="app">
    <form action="" method="get">
        <div>
            性别：
            <label for="male"><input type="radio" name="gender" id="male"  value="male" v-model="gender">Male</label>
            <label for="female"><input type="radio" name="gender" id="female"  value="female" v-model="gender">Female</label>
        </div>

        <!--恢复页面中设置的默认值-->
        <input type="reset" value="reset" v-on:click="reset">
        <!--表单提交到指定的页面-->
        <input type="submit" value="submit">

        <!--<button></button>-->
    </form>

    <h2>您选中的性别为：{{ gender }}</h2>
</div>

<script type="module">
    import {createApp, ref} from "../../../js/vue.esm-browser.js";

    let app = createApp(
        {
            setup() {
                let gender = ref("")
                function reset() {
                    gender.value = ""
                }
                return {
                    gender, reset,
                }
            }
        }
    );

    app.mount("#app")
</script>
</body>
</html>